var webpack = require("webpack");
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin("common.js");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var path=require('path')

module.exports = {
	// devtool:'eval',
	entry: [
	  'webpack-dev-server/client?http://0.0.0.0:3000', // WebpackDevServer host and port
	  'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
	  './src/routes' // Your appʼs entry point
	],
	output: {//打包输出
		path:__dirname,
		filename:"bundle.js",
		publicPath:'/static'
	},
	resolve: {//定义模块路径
		extensions:['','.js','jsx']
	},
	module: {//处理模块
		loaders:[{
			test:/\.js$/,
			loaders:['react-hot','babel-loader'],
			include: [path.join(__dirname, 'src')]
		}, {
			test:/\.jsx$/,
			loaders:['react-hot','babel-loader'],
			include: [path.join(__dirname, 'src')]
		}, {
			test:/\.json$/,
			loader:'json'
		},{
			test: /\.css$/, 
			loader: ExtractTextPlugin.extract("style-loader", "css-loader")
		}]
	},
	plugins:[commonsPlugin,new ExtractTextPlugin("style.css", {allChunks: true}),new webpack.HotModuleReplacementPlugin()]
};